package com.tcs.service;

import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.tcs.dao.ArticleDao;
import com.tcs.model.Article;

@Service("articleService")
@Transactional
public class ArticleServiceImpl implements ArticleService {

	@Resource
	private ArticleDao articleDao;

	public ArticleServiceImpl() {
	}

	public void addArticle(Article article) {
		articleDao.saveArticle(article);
	}

	public void updateArticle(Article article) {
		articleDao.updateArticle(article);
	}

	public void deleteArticle(int id) {
		articleDao.deleteArticle(id);
	}

	public List<Article> listArticles() {
		return articleDao.listArticles();
	}

	public List<Article> listArticlesByBrand(int ID) {
		return articleDao.listArticlesByBrand(ID);
	}

	@Override
	public Article getArticle(int ID) {

		return articleDao.getArticle(ID);
	}

}